Threading

The JDBC driver is completely thread safe; that is, it will not fail when database requests are made on separate threads.

Threading Architecture

A JDBC driver can be based on one of the following architectures:

Cancelling Functions in Multithreaded Applications

In a multithreaded application, a thread can use the cancel method to cancel a statement that is being executed by another thread. Whether the cancel method actually cancels the statement depends on the data store being accessed as shown in Table 8-2.

In both cases, the cancel method returns SQL_SUCCESS. If the cancel method has been called from a different thread while a request is pending, the original statement will return SQL_ERROR with the error message Operation cancelled.

Table 8-2. Using Cancel in Multithreaded JDBC Applications 
Data Store
SQLCancel
DB2 UDB on z/OS
Ignored
DB2 UDB on Windows
OK
DB2 UDB on Linux/UNIX
Ignored
Informix
OK
Microsoft SQL Server
OK
Oracle on Windows
Ignored
Oracle on UNIX
OK
Sybase
OK
NOTE: Cancel functionality is not supported when the connection uses Secure Socket Layer (SSL) encryption.